package com.atguigu.springbootredis;

import com.atguigu.springbootredis.entity.User;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;

@SpringBootTest
public class ApplicationTest2 {

    @Autowired
    private StringRedisTemplate stringRedisTemplate;


    @Test
    public void testRedis() {
        stringRedisTemplate.opsForValue().set("name2", "zhangsan");
        System.out.println(stringRedisTemplate.opsForValue().get("name2"));
    }

    /*@Test
    public void testUser() {

        User user = new User();
        user.setId(1);
        user.setName("zhangsan");

        stringRedisTemplate.opsForValue().set("user", user);
        System.out.println(stringRedisTemplate.opsForValue().get("name"));
    }*/
}
